<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="数据日期">
              <j-date placeholder="请选择数据日期" v-model="queryParam.sjrq"></j-date>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="是否为合计行">
              <j-tree-select
                ref="treeSelect"
                placeholder="请选择是否为合计行"
                v-model="queryParam.sfwhjh"
                dict="llbb_param_config,name,code"
                pidValue="1486500350999949313"
                hasChildField="has_child"
              >
              </j-tree-select>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
              <a @click="handleToggleSearch" style="margin-left: 8px">
                {{ toggleSearchStatus ? '收起' : '展开' }}
                <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
              </a>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <!--<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>-->
      <a-button type="primary" icon="download" @click="handleExportXls('同一债权人信息及账户归户情况_理财产品信息_存续表')">导出</a-button>
      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
        <!--<a-button type="primary" icon="import">导入</a-button>-->
      </a-upload><!--  v-has="'lccpxxcxb:check'"  v-has="'lccpxxcxb:downloadResult'"  v-has="'lccpxxcxb:submit'" -->
      <!--<a-button @click="handleCheck('check,lccpxxcxb')" type="primary" icon="check-square" >校验</a-button>-->
      <!--<a-button @click="handleExportXlsCheck('校验结果表,lccpxxcxb')" type="primary" icon="download" >下载校验结果</a-button>-->
      <!--<a-button @click="handleCommit('commit,lccpxxcxb')" type="primary" icon="check" >提交</a-button>-->
      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay">
          <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
        </a-menu>
        <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
      </a-dropdown>
    </div>

    <!-- table区域-begin -->
    <div>

      <a-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        class="j-table-force-nowrap"
        @change="handleTableChange">

        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="imgSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
          <a-button
            v-else
            :ghost="true"
            type="primary"
            icon="download"
            size="small"
            @click="downloadFile(text)">
            下载
          </a-button>
        </template>

        <span slot="action" slot-scope="text, record">
          <a @click="handleDetail(record)">详情</a>

          <!--<a @click="handleEdit(record)">编辑</a>

          <a-divider type="vertical" />
          <a-dropdown>
            <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a @click="handleDetail(record)">详情</a>
              </a-menu-item>
              <a-menu-item>
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>-->
        </span>

      </a-table>
    </div>
    <SjrqModal ref="SjrqModal" :handleAdd="handleAdd"></SjrqModal>
    <sc-lccpxxcxb-modal ref="modalForm" @ok="modalFormOk"></sc-lccpxxcxb-modal>
  </a-card>
</template>

<script>

  import '@/assets/less/TableExpand.less'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import ScLccpxxcxbModal from './modules/ScLccpxxcxbModal'
  import SjrqModal from '@views/ckbx/common/sjrq/SjrqModal'

  export default {
    name: 'ScLccpxxcxbList',
    mixins:[JeecgListMixin, mixinDevice],
    components: {
      SjrqModal,
      ScLccpxxcxbModal
    },
    data () {
      return {
        description: '同一债权人信息及账户归户情况_理财产品信息_存续表管理页面',
        // 表头
        columns: [
          {
            title: '选项',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          /*{
            title:'法人标识',
            align:"center",
            dataIndex: 'bankNoCd'
          },*/
          {
            title:'数据日期',
            align:"center",
            dataIndex: 'sjrq',
            customRender:function (text) {
              return !text?"":(text.length>10?text.substr(0,10):text)
            }
          },
          {
            title:'内部机构号',
            align:"center",
            dataIndex: 'nbjgh'
          },
          {
            title:'数据来源',
            align:"center",
            dataIndex: 'dataSources'
          },
          {
            title:'是否为合计行',
            align:"center",
            dataIndex: 'sfwhjh_dictText'
          },
          {
            title:'理财产品序号',
            align:"center",
            dataIndex: 'lccpxh'
          },
          {
            title:'产品编码',
            align:"center",
            dataIndex: 'cpbm'
          },
          {
            title:'产品名称',
            align:"center",
            dataIndex: 'cpmc'
          },
          {
            title:'产品类型',
            align:"center",
            dataIndex: 'cplx_dictText'
          },
          {
            title:'产品金额',
            align:"center",
            dataIndex: 'cpje'
          },
          {
            title:'产品净值',
            align:"center",
            dataIndex: 'cpjz'
          },
          {
            title:'是否为集合理财产品',
            align:"center",
            dataIndex: 'sfwjhlccp_dictText'
          },
          {
            title:'集合理财产品编码',
            align:"center",
            dataIndex: 'jhlccpbm'
          },
          {
            title:'备注',
            align:"center",
            dataIndex: 'bz'
          },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            fixed:"right",
            width:147,
            scopedSlots: { customRender: 'action' }
          }
        ],
        url: {
          list: "/lccpxxcxb/scLccpxxcxb/list",
          delete: "/lccpxxcxb/scLccpxxcxb/delete",
          deleteBatch: "/lccpxxcxb/scLccpxxcxb/deleteBatch",
          exportXlsUrl: "/lccpxxcxb/scLccpxxcxb/exportXls",
          importExcelUrl: "lccpxxcxb/scLccpxxcxb/importExcel",
          dataCheckUrl: "/lccpxxcxb/scLccpxxcxb/dataCheck",
          dataCommitUrl: "/lccpxxcxb/scLccpxxcxb/dataCommit",
          dataVerification: "/lccpxxcxb/scLccpxxcxb/dataVerification"
        },
        dictOptions:{},
        superFieldList:[],
      }
    },
    created() {
    this.getSuperFieldList();
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
    },
    methods: {
      initDictConfig(){
      },
      getSuperFieldList(){
        let fieldList=[];
        fieldList.push({type:'string',value:'bankNoCd',text:'法人标识'})
        fieldList.push({type:'string',value:'nbjgh',text:'内部机构号'})
        fieldList.push({type:'date',value:'sjrq',text:'数据日期'})
        fieldList.push({type:'string',value:'dataSources',text:'数据来源'})
        fieldList.push({type:'int',value:'sjdqps',text:'数据当前片数'})
        fieldList.push({type:'string',value:'sfwhjh',text:'是否为合计行'})
        fieldList.push({type:'int',value:'lccpxh',text:'理财产品序号'})
        fieldList.push({type:'string',value:'cpbm',text:'产品编码'})
        fieldList.push({type:'string',value:'cpmc',text:'产品名称'})
        fieldList.push({type:'string',value:'cplx',text:'产品类型'})
        fieldList.push({type:'number',value:'cpje',text:'产品金额'})
        fieldList.push({type:'number',value:'cpjz',text:'产品净值'})
        fieldList.push({type:'string',value:'sfwjhlccp',text:'是否为集合理财产品'})
        fieldList.push({type:'string',value:'jhlccpbm',text:'集合理财产品编码'})
        fieldList.push({type:'string',value:'bz',text:'备注'})
        this.superFieldList = fieldList
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>